Skip to content

Conversation

@igooch
Copy link
Contributor

@igooch igooch commented Nov 11, 2025

This pull request addresses a bug in the sandbox_client.py that caused it to fail when using a SandboxWarmPool. The client made incorrect assumptions about the naming of Sandbox and Pod resources when they are sourced from a warm pool, leading to "not found" errors.

Specifically, this pull request introduces the change:

Correct Pod Name for Port-Forwarding: The client now correctly identifies the pod name for port-forwarding by checking for the agents.x-k8s.io/pod-name annotation on the Sandbox resource. If the annotation is present (indicating the pod is from a sandbox warm pool), it uses the specified pod name. Otherwise, it falls back to using the Sandbox name, preserving the existing behavior for on-demand sandboxes.

This change make the Python client fully compatible with SandboxWarmPools.

Other changes are for autopep8 formatting only.

Fixes #149

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 11, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented Nov 11, 2025

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit d2e175b
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/691cf6840be2710008ad3c5d

@k8s-ci-robot
Copy link
Contributor

Welcome @igooch!

It looks like this is your first PR to kubernetes-sigs/agent-sandbox 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/agent-sandbox has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 11, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @igooch. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 11, 2025
@igooch igooch marked this pull request as ready for review November 11, 2025 21:31
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 11, 2025
Copy link

@aditya-shantanu aditya-shantanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test in this PR or have a fast follow up.
Do we have the framework set up to be able to test the python client ?

@janetkuo
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 11, 2025
@igooch
Copy link
Contributor Author

igooch commented Nov 11, 2025

Add a test in this PR or have a fast follow up. Do we have the framework set up to be able to test the python client ?

There is not currently a framework to test the python client. Also, as it stands the sandbox_client.py is quite specific to the agent-sandbox/examples/python-runtime-sandbox/main.py in that it assumes an /execute endpoint, assumes an exposed port, etc. That means this tests is dependent on having the python-runtime-sandbox image available to install into a sandboxtemplate and / or warmpool, and I don't believe this image has been publicly published yet.

So for an e2e test we'll either need to make this client more generic, or have a published version of the python-runtime-sandbox image available for the test to pull into the kind test cluster.

@k8s-ci-robot
Copy link
Contributor

@peterzhongyi: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Contributor

@barney-s barney-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR correctly fixes the bug with SandboxWarmPool compatibility by using the pod name annotation. The approach is good.

I've added a few comments regarding defensive programming, maintainability, and the need for unit tests to ensure the new logic is covered. Please address them.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 14, 2025
@barney-s
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 17, 2025
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 18, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 18, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 18, 2025
Copy link
Member

@janetkuo janetkuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aditya-shantanu, igooch, janetkuo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 18, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4c28fab into kubernetes-sigs:main Nov 18, 2025
10 checks passed
@barney-s
Copy link
Contributor

thanks.
/lgtm

@igooch igooch deleted the sandbox-client branch November 19, 2025 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python Client Fails with Warm Pools

6 participants